import { AxiosRequestConfig } from 'axios';
import { CSSProperties, ReactElement } from 'react';
import { WrappedFormMethods } from 'rc-form';
import store from '@/store';

export type RootState = ReturnType<typeof store.getState>;
export type Dispatch = typeof store.dispatch;

export interface IMenuBarProps {
  show: boolean;
  pathname: string;
}

export interface IHttpHooksProps extends AxiosRequestConfig {
  watch?: any[];
}

export interface IHttpUtilsProps extends AxiosRequestConfig {
  setResult?: any;
  setLoading?: any;
}

export interface ICityItemProps {
  value: string;
  label: string;
}

export interface ISearchProps {
  citys: ICityItemProps[];
  citysLoading: boolean;
}

export interface IHouseItemProps {
  id: number | string;
  imgs: any[];
  name: string;
  info: string;
  price: number | string;
  publishTime?: string | number;
  startTime?: string | number;
  endTime?: string | number;
}

export interface IHotProps {
  houses: IHouseItemProps[];
}

export interface ILazyLoadProps {
  component?: any;
  delay?: number;
}

export interface IErrorProps {
  img: ReactElement;
  title: string;
  message: string;
}

export interface ISearchQueryProps {
  code?: string[];
  startTime?: string;
  endTime?: string;
}

export interface IPageProps {
  pageSize: number;
  pageNum: number;
}

export interface IEmptyProps {
  image?: string;
  desc?: string;
  imgStyle?: CSSProperties;
}

export interface ILoadMoreProps {
  show: boolean;
  id?: string;
  loadText?: string;
  endText?: string;
}

export interface IActionProps {
  type: string;
  [key: string]: any;
}

export interface IBannerProps {
  banner: { url: string }[];
}

export interface ICommentProps {
  id: string | number;
  createTime: string | number;
  user: {
    avatar: string;
    username: string;
  };
  username: string;
  msg: string;
}

export interface IHouseCommentsProps {
  showLoadMore: boolean;
  list: ICommentProps[];
}

export interface IHouseInfoProps {
  detail: IHouseItemProps | null;
  order: IOrderItemProps | null;
  btnClick: (arg: any) => void;
}

export interface IHouseDetailProps extends IBannerProps {
  info: IHouseItemProps;
}

export interface IOrderItemProps {
  id: number;
  name: string;
  price: number;
  info: string;
  imgs: any[];
  createTime: string;
  isPayed?: number;
}

export interface IRcFormProps {
  form: WrappedFormMethods;
}
